<!--
<template>
  <div class="all">
    <div style="position: sticky;top: 0;z-index: 9999" class="header">
        <span @click="goBack()" class="fanhui">
          <img src="../../assets/返回.png" alt="lazy" loading="lazy">
          <span class="sides">返回</span>
        </span>
      <van-search
        v-model="searchValue"
        shape="round"
        placeholder="请输入搜索关键词"
        left-icon=""
        show-action
        @keyup="onSearch"
        @clear="onSearch"
      >
        <template #left-icon>
          <div @click="onSearch">
            <van-icon name="search" />
          </div>
        </template>
        <template #action>
          &lt;!&ndash;          <div style="" @click="onSearch" class="sousuo">搜索</div>&ndash;&gt;
        </template>
      </van-search>
      <span></span>
    </div >
    <div class="menu">
      <ul @click="topMenuOnchange"
      >
        <li v-for="(item, index) in modelMenu"
            :key="index"
            @click="topActive = item.index, type = item.type"
            :class="[topActive === item.index ? 'select' : '']"
        >{{item.name}}</li>
      </ul>
    </div>

    &lt;!&ndash;康护 护理 开始&ndash;&gt;
    <van-tabs
      sticky
      offset-top="24vw"
      v-model="KHactive"
      swipeable
      animated
      color="#1da4f2"
      title-active-color="#1da4f2"
      line-width="40px"
      line-height="2px"
      @change="KHonchange"
      v-if="Number(topActive) == 0 || Number(topActive) == 1"
    >
      <van-tab
        v-for="(item, index) in khTabList"
        :key="index"
        :title="item.name"
        :name="item.type"
      >
        <div class="KHbox" v-if="Number(topActive) == 0 || Number(topActive) == 1" v-for="(Orditem, Ordindex) in orderList" :key="Ordindex">
          <div class="orderTop">
            <span class="orderLeft">
              <a class="typeName" >
                  {{Orditem.TYPE == 3 ? '康' :
                Orditem.TYPE == 4 ? '护':
                  Orditem.TYPE == 7 ? '生':
                    Orditem.TYPE == 8 ? '养':
                      ''
                }}
              </a>
&lt;!&ndash;              <a class="typeName" v-show="Orditem.TYPE == 0">康</a>&ndash;&gt;
&lt;!&ndash;              <a class="typeName" v-show="Orditem.TYPE == 1">护</a>&ndash;&gt;
            {{Orditem.ITEM_NAME}}
            </span>
            <span class="statusSpan" v-show="(Orditem.STATUS == 2 && Orditem.FINISH == 0 && Orditem.CONFIRM == 0 && Orditem.APPRAISE_STATUS == 0)">已完成</span>
            <span class="statusSpan" v-show="Orditem.STATUS == 4 && Orditem.REFUND == 2">订单已取消,退款中</span>
            <span class="statusSpan" v-show="Orditem.STATUS == 4 && Orditem.REFUND == 3">订单已取消,退款成功</span>
            <span class="statusSpan" v-show="Orditem.STATUS == 4 && Orditem.REFUND == 4">订单已取消,退款失败</span>
            <span class="statusSpan" v-show="Orditem.STATUS == 3 || Orditem.STATUS == 5">订单已取消</span>

            <span class="statusSpan" v-show="Orditem.STATUS == 1">待支付</span>
            <span class="statusSpan" v-show="Orditem.STATUS == 2 && Orditem.CONFIRM == 1">待接单</span>
            <span class="statusSpan" v-show="Orditem.STATUS == 2 &&  Orditem.FINISH == 1 && Orditem.CONFIRM == 0">待服务</span>
            <span class="statusSpan" v-show="Orditem.STATUS == 2 &&  Orditem.FINISH == 0 && Orditem.CONFIRM == 0 && Orditem.APPRAISE_STATUS == 1">待评价</span>

          </div>
          <ul class="orderUl" >
            <li v-for="(item, index) in ulList" :key="index">
              <img :src="item.img" class="tubiao" alt="">
              <span v-if="Orditem.STATUS == 1 || (Orditem.STATUS == 2 && Orditem.CONFIRM == 1)">{{item.name1}}</span>
              <span v-else>{{item.name}}</span>
              <span :style="[item.forName === 'REAL_AMOUNT' ? {'color': '#E3170D'} : '']"><span v-show="item.forName === 'REAL_AMOUNT'">￥</span> {{Orditem[item.forName]}}</span>
            </li>
          </ul>
          <div class="orderBottom">
            <button v-show="Orditem.STATUS == 1"
                    @click="KHpay(Orditem.ORDER_ID, Orditem.ITEM_ID, Orditem.TYPE)">立即支付</button>
            <button v-show="Orditem.STATUS == 1 || (Orditem.STATUS == 2 && Orditem.CONFIRM == 1)"
                    @click="cancelReser(Orditem.ORDER_ID)">取消预约</button>
            <button v-show="(Orditem.STATUS == 2 && Orditem.FINISH == 1 && Orditem.CONFIRM == 0)"
                    @click="confirmComple(Orditem.ORDER_ID)"
            >确认服务</button>
            <button v-show="(Orditem.STATUS == 2 && Orditem.FINISH == 0 && Orditem.APPRAISE_STATUS == 1)">未评价</button>
          </div>
        </div>
      </van-tab>
    </van-tabs>
    &lt;!&ndash;康护 护理 结束&ndash;&gt;
    &lt;!&ndash;图文视频开始&ndash;&gt;
    <van-tabs
      sticky
      offset-top="24vw"
      v-model="active"
      swipeable
      animated
      color="#1da4f2"
      title-active-color="#1da4f2"
      line-width="40px"
      line-height="2px"
      @change="onchange"
      v-if="topActive == 2 || topActive == 3 || topActive == 4"
    >
      <van-tab
        v-for="(item, index) in (type == 1 ? tabList : tabList1)"
        :key="index"
        :title="item.name"
        :name="item.id">
        <div>
          <div class="box" v-for="(item, index) in orderList" :key="index" @click="clickBox(item)">
            <div class="boxTop">
              <div class="boxTop_left">
               <span>
                  <img v-if="item.doctorPhoto !== null && item.doctorPhoto !== undefined && item.doctorPhoto !== ''"
                       class="photo" :src="item.doctorPhoto" alt="">
                <img v-else class="photo" src="../../assets/男医生@2x.png" alt="">
               </span>
                <span style="display: flex;
flex-direction: column">
                    <a>{{item.NICK_NAME}}
                      <button v-show="item.team_id" class="tagTuandui">团队</button>

                    </a>
                    <a style="font-size: 11px;color: #333">{{item.MAJOR}} | {{item.DEPART}}</a>
                </span>
              </div>
              <div class="boxTop_right ">
                <span v-show="item.status == 1" class="red">待支付</span>
                <span v-show="item.status == 4" class="green">{{typeLabel}}中</span>
                <span v-show="item.status == 5" class="blue">已结束</span>
                &lt;!&ndash;                `refund_status` tinyint(4) DEFAULT NULL COMMENT '退款状态 1:退款中;2:退款成功;3:退款状态',&ndash;&gt;
                <span v-show="item.status == 6 && item.refund_status == 1" class="blue">订单已取消，退款中</span>
                <span v-show="item.status == 6 && item.refund_status == 2" class="blue">订单已取消，退款成功</span>
                <span v-show="item.status == 6 && item.refund_status == 3" class="blue">订单已取消，退款失败</span>
                <span  v-show="item.status == 6 && item.refund_status == null">订单已取消</span>

                <span v-show="item.status == 2 && (type == 2 || type == 5)" class="green">待接单</span>
                <span v-show="item.status == 3 && type == 2  && item.is_signin == 0" class="green">预约已确认</span>
                <span v-show="item.status == 3 && type == 2  && item.is_signin == 1" class="green">待接诊</span>
                <span v-show="item.status == 3 && type == 5" class="green">待接诊</span>

                <span v-show="item.status == 3 && type == 1" class="green">待接诊</span>

              </div>
            </div>
            <div class="boxContent">
              <div class="boxContent_text">
                <span style="white-space: nowrap">自述情况：</span>
                <span style="width: 80%;display: flex;
                      overflow:hidden;
                      text-overflow:ellipsis;
                      -webkit-line-clamp:2;
                      word-break: break-all;
                      -webkit-box-orient:vertical;
                      display: -webkit-box;
">
                    {{item.illness_desc}}</span>
              </div>
            </div>
            <div class="boxContent_bottom">
              <div class="time">
                <p v-show="item.status == 1 || item.status == 3 || (item.status == 2 && (type == 2 || type == 5))">申请时间：{{item.created_at}} </p>
                <p v-show="item.status == 4 || item.status == 5">开始{{typeLabel}}时间：{{item.start_time}}</p>
                <p v-show=" item.status == 5">结束{{typeLabel}}时间：{{item.end_time}}</p>
                <p v-show="item.status == 4">已{{typeLabel}}：{{GetDateDiff(new Date() - new Date(item.start_time))}}</p>
                <p v-show="item.status == 6">订单取消时间：{{item.cancel_time}}</p>
                <p v-show="item.status == 6 && item.cancel_type !== 3">订单取消原因：
                  <a v-show="item.cancel_type == 1">手工操作</a>
                  <a v-show="item.cancel_type == 2 && item.refund_status == null">支付超时</a>
                  <a v-show="item.cancel_type == 2&& item.refund_status !== null">接诊超时</a>
                  <a v-show="item.cancel_type == 4">{{item.cancel_reason}}</a>
                  &lt;!&ndash;                  '取消类型 1:患者手动;2:系统自动;3:医生拒诊'&ndash;&gt;
                </p>
                <p v-show="item.cancel_type == 3">退诊原因：{{item.cancel_reason}}</p>
                &lt;!&ndash;视频&ndash;&gt;
                <p v-show="(item.status == 1 || item.status == 2) && item.type ==2">
                  预约{{typeLabel}}时间：{{item.book_date}}  {{item.book_time_start}} ~ {{ item.book_time_end}}</p>

                <p v-show="(item.status == 2 || item.status == 3) && type == 5">
                  预约{{typeLabel}}时间：{{item.book_date}}  {{item.book_time_start}} ~ {{ item.book_time_end}} </p>

                <p v-show="(item.status == 3) && item.type ==2">
                  {{typeLabel}}时间：{{item.book_date}}  {{item.book_time_start}} ~ {{ item.book_time_end}}</p>
              </div>
            </div>
            <div class="price">
              <span >订单金额：</span>
              <span>￥{{item.amount}}</span>
            </div>
            <div class="boxBottom">
              <div class="">
                &lt;!&ndash;                 待接诊 &ndash;&gt;
                <span class="qianDao"  v-show="(item.status == 3  && item.type == 2 && item.is_signin == 0)">
                     <img
                       style="width: 15px;height: 15px;" src="../../assets/未签到.png" alt="">
                      未签到
                  </span>

                &lt;!&ndash;               待接诊已确认 &ndash;&gt;
                <span class="qianDao" v-show="(item.status == 3  && item.type == 2 && item.is_signin == 1)">
                    <img
                      style="width: 15px;height: 15px;" src="../../assets/已签到.png" alt="">
                    <a style="color: #1da4f2">
                      已签到 ({{formatDate(item.signin_time)}})
                    </a>
                  </span>
              </div>

              <div style="display: flex">
                &lt;!&ndash;              视频咨询  status 3 已确认 签到&ndash;&gt;
                <button class="box_button btnBlack"
                        @click.stop="qianDao(item)"
                        v-show="item.status == 3 && type == 2 && item.is_signin == 0 && item.pList && item.pList.length>0 && userid == item.pList[0].partake_user_id">签到</button>
                <button class="box_button btnBlack"
                        @click.stop="houZhen(item)"
                        v-show="item.status == 3 && type == 2 && item.is_signin == 1 && item.pList && item.pList.length>0 && userid == item.pList[0].partake_user_id">进入候诊室</button>

                &lt;!&ndash;              未支付取消&ndash;&gt;
                <button class="box_button btnBlack" @click.stop="cancel(item)"
                        v-show="item.status == 1 && userid == item.op_user_id">取消订单</button>

                &lt;!&ndash;               未接诊取消&ndash;&gt;
                <button class="box_button btnBlack" @click.stop="weiCancal(item)"
                        v-show="(item.status == 3 && item.type ==1) && userid == item.op_user_id ">取消订单2</button>

                &lt;!&ndash;                  待接诊取消&ndash;&gt;
                <button class="box_button btnBlack" @click.stop="weiJieQuXiaoShiPin(item)"
                        v-show="item.status == 2 &&
                         ((item.type == 2 && item.pList && item.pList.length>0 && userid == item.pList[0].partake_user_id)||
                          (item.type == 5 && userid == item.op_user_id))">取消订单</button>
                &lt;!&ndash;                未支付 支付&ndash;&gt;
                <button class="box_button btnBule" @click.stop="pay(item)"
                        v-show="item.status == 1 && userid == item.op_user_id">立即支付</button>

                <button class="box_button btnBlack" @click.stop="guoCheng(item)"
                        v-show="item.status == 5">{{typeLabel}}记录</button>
                <button class="box_button btnBule" @click.stop="pingJia(item)"
                        v-show="item.status == 5">服务评价</button>

                <button class="box_button btnBule" @click.stop="jumpZixun(item)"
                        v-show="item.status == 4 && type == 1">继续{{typeLabel}}</button>
              </div>

            </div>
          </div>
        </div>
      </van-tab>
    </van-tabs>
    &lt;!&ndash;图文视频结束&ndash;&gt;
    <div  style="width: 100%;height: 50vh;display: flex;align-items: center;justify-content: center" v-show="isLoading">
      <van-loading size="24px" type="spinner" color="#1989fa">加载中...</van-loading>
    </div>
    <van-empty
      style="width: 100%;height: 60%"
      v-show="orderList && orderList.length <= 0 && isLoading === false"
      class="custom-image"
      :image="require('../../assets/空两本书.png')"
      :description="nullOrderText"
    />
    &lt;!&ndash;康护开始&ndash;&gt;
    <van-dialog v-model="KHcancelShow"
                width="80%"
                confirm-button-color="#1da4f2"
                title="确认取消预约吗？"
                @confirm="KHcancelConfirm()"
                show-cancel-button>
    </van-dialog>
    <van-dialog v-model="confirmShow"
                width="80%"
                confirm-button-color="#1da4f2"
                title="您确认已完成服务了吗？"
                @confirm="yesConfirm()"
                show-cancel-button>
    </van-dialog>
    <van-dialog v-model="KHpayShow"
                width="80%"
                confirm-button-color="#1da4f2"
                title="是否确认继续支付？"
                @confirm="KHpayConfirm()"
                show-cancel-button>
    </van-dialog>
    &lt;!&ndash;    康护结束&ndash;&gt;

&lt;!&ndash;    图文 视频 远程 开始&ndash;&gt;
    <van-dialog v-model="endShow"
                width="80%"
                confirm-button-color="#1da4f2"
                title="确认结束此次咨询吗？"
                @confirm="endConfirm()"
                show-cancel-button>
    </van-dialog>
    <van-dialog v-model="cancelShow"
                width="80%"
                confirm-button-color="#1da4f2"
                title="确认取消此订单吗？"
                @confirm="cancelConfirm()"
                show-cancel-button>
    </van-dialog>
    <van-dialog v-model="weiCancalShow"
                width="80%"
                confirm-button-color="#1da4f2"
                title="确认取消此订单吗？"
                @confirm="weiCancalConfirm()"
                show-cancel-button>
    </van-dialog>
    <van-dialog v-model="qianDaoShow"
                width="80%"
                confirm-button-color="#1da4f2"
                title="确认签到吗？"
                @confirm="qianDaoConfirm()"
                show-cancel-button>
    </van-dialog>
    <van-dialog v-model="weiJieQuXiaoShiPinShow"
                width="80%"
                confirm-button-color="#1da4f2"
                title="确认取消此订单吗？"
                @confirm="weiJieQuXiaoShiPinConfirm()"
                show-cancel-button>
    </van-dialog>
&lt;!&ndash;    图文 视频 远程 结束&ndash;&gt;

    <div v-show="quxiaoisLoading"
         style="width: 100%;height: 100%;display: flex;align-items: center;justify-content: center;position: absolute;top: 0;background: rgba(0, 0, 0, 0.5)" >
      <van-loading size="24px" type="spinner" color="#fff">订单取消中...</van-loading>
    </div>
  </div>
</template>

<script>
import HTTP from '../../http/video.http'
import {Toast} from 'vant'
export default {
  name: 'AllOrder',
  data () {
    return {
      userid: this.$route.query.userid,
      searchValue: '',
      modelMenu: [
        {
          name: '居家康复',
          index: 0,
          type: 3
          // type: 0
        },
        {
          name: '居家护理',
          index: 1,
          type: 4
          // type: 1
        },
        {
          name: '远程会诊',
          index: 2,
          type: 5
        },
        {
          name: '图文咨询',
          index: 3,
          type: 1
        },
        {
          name: '视频咨询',
          index: 4,
          type: 2
        }
      ],
      topActive: 0,
      khTabList: [
        {
          name: '全部',
          type: 0
        },
        {
          name: '待支付',
          type: 1
        },
        {
          name: '待接单',
          type: 2
        },
        {
          name: '待服务',
          type: 3
        },
        {
          name: '待评价',
          type: 4
        },
        {
          name: '已完成',
          type: 5
        },
        {
          name: '已取消',
          type: 6
        }
      ], // kh
      ulList: [
        {
          name: '被服务人：',
          name1: '被服务人：',
          img: require('../../assets/被服务人员@2x.png'),
          forName: 'PATIENT_NAME'
        },
        {
          name: '预约服务日期：',
          name1: '预约服务日期：',
          img: require('../../assets/预约时间@2x.png'),
          forName: 'DATE'
        },
        {
          name: '预约服务时间：',
          name1: '预约服务时间：',
          img: require('../../assets/预约时间@2x.png'),
          forName: 'TIME'
        },
        {
          name: '服务地址：',
          name1: '服务地址：',
          img: require('../../assets/服务地址@2x.png'),
          forName: 'ADDRESS'
        },
        {
          name: '项目金额：',
          name1: '项目金额：',
          img: require('../../assets/项目金额@2x.png'),
          forName: 'REAL_AMOUNT'
        },
        {
          name: '预约服务人员：',
          name1: '服务人员：',
          img: require('../../assets/被服务人员@2x.png'),
          forName: 'STAFF_NAME'
        },
        {
          name: '预约人员：',
          name1: '操作人员：',
          img: require('../../assets/被服务人员@2x.png'),
          forName: 'USER_NAME'
        },
        {
          name: '操作时间：',
          name1: '操作时间：',
          img: require('../../assets/预约时间@2x.png'),
          forName: 'ORDER_TIME'
        }
      ], // kh
      orderList: [],
      KHcancelShow: false, // kh
      orderID: '', // kh
      confirmShow: false, // kh
      KHpayShow: false, // kh
      itemID: '', // kh
      KHtype: '',
      KHactive: '', // kh
      // 以下全是 tw
      active: 0,
      tabList: [
        {
          name: '全部',
          id: ''
        },
        {
          name: '待支付',
          id: '1'
        },
        {
          name: '待接诊',
          id: '3'
        },
        {
          name: '咨询中',
          id: '4'
        },
        {
          name: '已结束',
          id: '5'
        },
        {
          name: '已取消',
          id: '6'
        }
      ],
      tabList1: [
        {
          name: '全部',
          id: ''
        },
        {
          name: '待支付',
          id: '1'
        },
        {
          name: '待接单',
          id: '2'
        },
        {
          name: '待接诊',
          id: '3'
        },
        {
          name: '咨询中',
          id: '4'
        },
        {
          name: '已结束',
          id: '5'
        },
        {
          name: '已取消',
          id: '6'
        }
      ],
      type: 3,
      xuzhiShow: false,
      isSelect: false,
      nullOrderText: '',
      ITEM: '',
      endShow: false,
      cancelShow: false,
      weiCancalShow: false,
      isLoading: true,
      qianDaoShow: false,
      weiJieQuXiaoShiPinShow: false,
      quxiaoisLoading: false
    }
  },
  computed: {
    typeLabel: function () {
      if (this.type === 2) {
        this.$set(this.tabList1[4], 'name', '咨询中')
        return '咨询'
      } else {
        this.$set(this.tabList1[4], 'name', '会诊中')
        return '会诊'
      }
    },
    typeTitle: function () {
      if (this.type === 1) {
        document.title = '图文咨询'
        return '图文咨询'
      } else if (this.type === 2) {
        document.title = '视频咨询'
        return '视频咨询'
      } else if (this.type === 5) {
        document.title = '远程会诊'
        return '远程会诊'
      }
    },
    timeIng () {
      return function (nowTime, oldTime) {
        let date = new Date(new Date(nowTime) - new Date(oldTime))
        let hour = date.getUTCHours()
        let min = date.getUTCMinutes()
        if (hour < 10) {
          hour = '0' + hour
        }
        if (min < 10) {
          min = '0' + min
        }
        if (Number(hour) <= 0) {
          return min + '分钟'
        } else {
          return hour + '小时' + min + '分钟'
        }
      }
    }
  },
  mounted () {
    if (sessionStorage.getItem('allOrderActive')) {
      let data = JSON.parse(sessionStorage.getItem('allOrderActive'))
      this.topActive = data.topActive
    }
    if (this.$route.query.MARK === undefined || this.$route.query.MARK === null || this.$route.query.MARK === '') {
    } else {
      // this.active = Number(this.$route.query.MARK)
    }
    this.topMenuOnchange()
  },
  methods: {
    // 支付
    KHpay (orderID, itemID, type) {
      this.orderID = orderID
      this.itemID = itemID
      this.KHtype = type
      this.KHpayShow = true
    },
    KHpayConfirm () {
      // eslint-disable-next-line eqeqeq
      if (this.KHtype == 0) {
        location.href = HTTP.zhaoPinHttp + '/jjkf/itemdetail.do?ITEM_ID=' + this.itemID + '&ORDER_ID=' + this.orderID
        // eslint-disable-next-line eqeqeq
      } else if (this.KHtype == 1) {
        location.href = HTTP.zhaoPinHttp + '/jjhl/itemdetail.do?ITEM_ID=' + this.itemID + '&ORDER_ID=' + this.orderID
      }
      // 康复
      // location.href="http://jmx-kfdj.com/kfhl/jjkf/itemdetail.do?ITEM_ID="+$(this).attr("itemid")+"&ORDER_ID="+$(this).attr("oid");

      // 护理
      // location.href="http://jmx-kfdj.com/kfhl/jjhl/itemdetail.do?ITEM_ID="+$(this).attr("itemid")+"&ORDER_ID="+$(this).attr("oid");
    },
    // 确认完成 按钮
    confirmComple (orderID) {
      this.orderID = orderID
      this.confirmShow = true
    },
    // 确认完成 接口
    yesConfirm () {
      this.$http.finishorder({ORDER_ID: this.orderID})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.getOrder()
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 取消预约 按钮
    cancelReser (orderID) {
      this.orderID = orderID
      this.KHcancelShow = true
    },
    // 取消预约 接口
    KHcancelConfirm () {
      this.quxiaoisLoading = true
      this.$http.cancelorder({ORDER_ID: this.orderID})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.getOrder()
            this.quxiaoisLoading = false
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 获取各个状态下的订单 kh
    getOrder () {
      this.isLoading = true
      this.$http.getorders({'KEY': this.searchValue, 'MARK': this.KHactive, TYPE: this.type})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.orderList = res.data.data
            this.isLoading = false
            if (Number(this.KHactive) === 0) {
              this.nullOrderText = '暂无任何订单哦'
            } else if (Number(this.KHactive) === 1) {
              this.nullOrderText = '暂无待支付订单哦'
            } else if (Number(this.KHactive) === 2) {
              this.nullOrderText = '暂无待接单订单哦'
            } else if (Number(this.KHactive) === 3) {
              this.nullOrderText = '暂无待服务订单哦'
            } else if (Number(this.KHactive) === 4) {
              this.nullOrderText = '暂无待评价订单哦'
            } else if (Number(this.KHactive) === 5) {
              this.nullOrderText = '暂无已完成订单哦'
            } else if (Number(this.KHactive) === 6) {
              this.nullOrderText = '暂无已取消订单哦'
            }
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 订单滑动切换
    KHonchange () {
      this.orderList = []
      this.getOrder()
    },
    // 获取不同状态 的订单  视频 图文 远程
    getData () {
      let type
      // eslint-disable-next-line eqeqeq
      if (this.topActive == 2) {
        type = 5
        // eslint-disable-next-line eqeqeq
      } else if (this.topActive == 3) {
        type = 1
        // eslint-disable-next-line eqeqeq
      } else if (this.topActive == 4) {
        type = 2
      }
      var status = this.active
      if (status == 0) {
        status = ''
      }
      this.isLoading = true
      this.$http.findAllInquiry({name: this.searchValue, type: type, status: status})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.isLoading = false
            this.orderList = res.data.data
            // 1:待支付;2:待预约;3:待服务;4:服务中;5:已完成;6:已取消'
            if (this.active === '') {
              this.nullOrderText = '暂无任何订单哦'
            } else if (Number(this.active) === 1) {
              this.nullOrderText = '暂无待支付订单哦'
            } else if (Number(this.active) === 2 && type == 1) {
              this.nullOrderText = '暂无待预约订单哦'
            } else if (Number(this.active) === 2 && (type == 2 || type == 5)) {
              this.nullOrderText = '暂无待接单订单哦'
            } else if (Number(this.active) === 3 && type == 1) {
              this.nullOrderText = '暂无待接诊订单哦'
            } else if (Number(this.active) === 3 && (type == 2 || type == 5)) {
              this.nullOrderText = '暂无待接诊订单哦'
            } else if (Number(this.active) === 4) {
              this.nullOrderText = '暂无' + this.typeLabel + '中订单哦'
            } else if (Number(this.active) === 5) {
              this.nullOrderText = '暂无已结束订单哦'
            } else if (Number(this.active) === 6) {
              this.nullOrderText = '暂无已取消订单哦'
            }
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 图文视频切换订单状态
    onchange () {
      this.orderList = []
      this.getData()
    },
    // 头部搜索
    onSearch () {
      if (Number(this.topActive) === 0 || Number(this.topActive) === 1) {
        this.getOrder()
      } else {
        this.getData()
      }
    },
    // 返回
    goBack () {
      this.$router.history.go(-1)
    },
    topMenuOnchange () {
      this.orderList = []
      if (Number(this.topActive) === 0 || Number(this.topActive) === 1) {
        this.getOrder()
      } else {
        this.getData()
      }
      if (Number(this.topActive) === 2) {
        this.type = 5
      } else if (Number(this.topActive) === 3) {
        this.type = 1
      } else if (Number(this.topActive) === 4) {
        this.type = 2
      }
      // console.log(this.type)
    },

    // 以下全是 视频 图文 远程
    formatDate (date) {
      var date = new Date(date)

      var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'

      var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'

      var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds())

      return hh + mm + ss
    },
    // 未接单 取消按钮
    weiJieQuXiaoShiPinConfirm () {
      this.quxiaoisLoading = true
      this.$http.weiJieQuXiaoShiPin({id: this.ITEM.id})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.weiJieQuXiaoShiPinShow = false
            this.getData()
            this.quxiaoisLoading = false
            Toast('订单取消成功')
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    weiJieQuXiaoShiPin (item) {
      this.ITEM = item
      this.weiJieQuXiaoShiPinShow = true
    },
    // 进入候诊室
    houZhen (item) {
      if (sessionStorage.getItem('sys') === 'ANDROID') {
        window.WebViewJavascriptBridge.callHandler('goToConsultWaitRoom', item.id, function (responseData) {})
      } else {
        Toast('请在App上使用本功能')
      }
    },
    // 签到确认按钮
    qianDaoConfirm () {
      this.$http.updateInQianDao({id: this.ITEM.id})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.getData()
            this.qianDaoShow = false
            Toast('签到成功')
          } else {
            Toast(res.data.msg)
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 签到
    qianDao (item) {
      this.ITEM = item
      this.$http.updateInQianDao({id: this.ITEM.id})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.getData()
            this.qianDaoShow = false
            Toast('签到成功')
          } else {
            Toast(res.data.msg)
          }
        })
        .catch(err => {
          console.log(err)
        })
      // this.qianDaoShow = true
      // updateInQianDao
    },
    // 计算 已会诊时长
    GetDateDiff (mss) {
      if (mss <= 0) {
        mss = 0
      }
      var date = new Date(mss)
      let hour = date.getUTCHours()
      let min = date.getUTCMinutes()
      // if (hour < 10) {
      //   hour = '0' + hour
      // }
      // if (min < 10) {
      //   min = '0' + min
      // }
      if (Number(hour) <= 0) {
        return min + '分钟'
      } else {
        return hour + '小时' + min + '分钟'
      }
    },
    // 查看咨询过程
    guoCheng (item) {
      if (sessionStorage.getItem('sys') === 'ANDROID') {
        window.WebViewJavascriptBridge.callHandler('consultChatHistory', item.id, function (responseData) {})
      } else {
        Toast('请在App上使用本功能')
      }
    },
    // 结束 确认按钮
    endConfirm () {
      this.$http.endTuWenZhen({id: this.ITEM.id})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.getData()
            Toast('操作成功，此次' + this.typeLabel + '已结束')
            this.endShow = false
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 结束
    jieShu (item) {
      this.ITEM = item
      this.endShow = true
    },
    pingJia (item) {
      Toast('正在开发中，敬请期待...')
      // this.$router.push({path: '/serviceEvaluation', query: {id: item.id}})
    },
    // 点击跳转安卓聊天
    jumpZixun (item) {
      if (sessionStorage.getItem('sys') === 'ANDROID') {
        window.WebViewJavascriptBridge.callHandler('doctorPatientChat', item.doc_user_id + ',' + item.NICK_NAME + ',' + item.type + ',' + item.id, function (responseData) {})
      } else {
        Toast('请在App上使用本功能')
      }
    },

    // 立即预约跳转 视频咨询
    YuYue (item) {
      sessionStorage.setItem('order', JSON.stringify(item))
      this.$router.push({path: '/tuWenYuyue', query: {id: item.id}})
    },
    // 未接诊取消订单 确认
    weiCancalConfirm () {
      this.quxiaoisLoading = true
      this.$http.weiJieQuXiao({id: this.ITEM.id})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.weiCancalShow = false
            this.getData()
            this.quxiaoisLoading = false
            Toast('订单取消成功')
          } else {
            Toast(res.data.msg)
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 未接诊取消订单
    weiCancal (item) {
      this.ITEM = item
      this.weiCancalShow = true
    },
    // 患者端 未支付 取消订单
    cancel (item) {
      this.ITEM = item
      this.cancelShow = true
    },
    // 取消订单确认按钮
    cancelConfirm () {
      this.quxiaoisLoading = true
      this.$http.weiZhiQuXiao({id: this.ITEM.id})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.getData()
            this.cancelShow = false
            this.quxiaoisLoading = false
            Toast('订单取消成功')
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 立即支付跳转
    pay (item) {
      sessionStorage.setItem('order', JSON.stringify(item))
      this.$router.push({path: '/third', query: {type: this.type}})
    },
    // 点击查看详情
    clickBox (data) {
      if (data.type == 2 && data.pList && data.pList.length > 0 && this.userid !== data.pList[0].partake_user_id) {

      } else if (data.status == 4 && data.type !== 5) {
        this.jumpZixun(data)
      } else if ((data.status == 3 || data.status == 4) && data.type == 5) {
        if (sessionStorage.getItem('sys') === 'ANDROID') {
          window.WebViewJavascriptBridge.callHandler('startGroupPageChat', data.id + ',' + data.im_group_id, function (responseData) {})
        }
      } else {
        sessionStorage.setItem('order', JSON.stringify(data))
        this.$router.push({path: '/tuWenOrder', query: {id: data.id, userid: this.userid, type: this.type}})
      }
    },
    // 点击医师建议
    jianyi (id) {
      this.$router.push({path: '/viewWenzhenSuggest', query: {id: id, type: this.type}})
    }
  },
  destroyed () {
    let obj = {
      topActive: this.topActive,
      active: this.active,
      KHactive: this.KHactive
    }
    sessionStorage.setItem('allOrderActive', JSON.stringify(obj))
  }
}
</script>

<style scoped>
/deep/ .van-search{
  width: 80%;
}
.all{
  width: 100%;
  height: 100%;
  background: #FAF9FE;
  font-family: PingFang SC;
  overflow: auto;
}
.header{
  width: 100%;
  height: 12vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: white;
  position: fixed;
  top: 0;
  z-index: 9999;
  /*border-bottom: 1px solid #E5E5E5;*/
  overflow: hidden;
}
.fanhui{
  display: flex;
  align-items: center;
  margin-left: 15px;
  color: #1da4f2;
}
.fanhui  img{
  width: 7px;
  height: 13px;
  margin-right: 5px;
}
.sides{
  font-size: 15px;
  font-family: PingFang SC;
  font-weight: bold;
}
.menu{
  width: 100%;
  height: 12vw;
  display: flex;
  align-items: center;
  padding: 0 20px;
  box-sizing: border-box;
  font-size: 15px;
  font-family: PingFang SC;
  font-weight: bold;
  overflow-x: auto;
  background: white;
  /*margin-bottom: 5px;*/
  position: sticky;
  top: 12vw;
  z-index: 9999;
}
.menu::-webkit-scrollbar{
  display: none;
}
.menu ul{
  width: auto;
  /*width: 98%; !* 可注释*!*/
  height: 29px;
  display: flex;
  align-items: center;
  /*margin-right: 20px;*/
}
.menu ul li:first-child{
  border-radius: 5px 0 0 5px;
}
/*.menu ul li:nth-child(2){ !* 可注释*!*/
/*  border-radius: 0px 5px 5px 0px;*/
/*}*/
.menu ul li:last-child{
  border-radius: 0px 5px 5px 0px;
  margin-right: 20px;
}
.menu ul li{
  min-width: 80px;
  /*width:80px;*/
  height: 29px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1da4f2;
  background: rgba(29, 164, 242, 0.1);
}
.select{
  color: white !important;
  background: #1da4f2 !important;
}
.KHbox{
  padding: 10px;
  box-sizing: border-box;
}
.KHbox,
.box{
  width: 95%;
  margin: 10px auto;
  background: white;
  border-radius: 10px;
  padding: 0 10px;
  box-sizing: border-box;
}
.orderTop{
  height: 60px;
  font-size: 15px;
  /*font-weight: bold;*/
  color: #333333;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.orderLeft{
  display: flex;
  align-items: center;
}
.orderUl{
  font-size: 13px;
  font-family: PingFang SC;
  font-weight: 500;
  color: #999999;
}
.orderUl li{
  display: flex;
  align-items: center;
  height: 30px;
}
.typeName{
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: #1DA4F2;
  border-radius: 50%;
  margin-right: 8px;
}
.statusSpan{
  color: #1DA4F2;
  display: flex;
}
.tubiao{
  width: 15px;
  height: 15px;
  margin-right: 8px;
}
.orderBottom{
  height: 44px;
  display: flex;
  align-items: center;
  flex-direction: row-reverse;
}
.orderBottom button{
  width: 90px;
  height: 29px;
  border: 1px solid #E3170D;
  border-radius: 14px;
  background: transparent;
  font-size: 15px;
  font-family: PingFang SC;
  font-weight: 500;
  color: #E3170D;
  margin-left: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 图文 视频 远程 以下*/
.box{
  width: 95%;
  border-radius: 10px;
  padding: 10px 0;
  box-sizing: border-box;
  background: white;
  margin: 10px auto auto auto;
  box-shadow: 0px 5px 20px 0px rgba(0, 0, 0, 0.05);
}
.content .box:last-child{
  margin-bottom: 30px !important;
}
.boxTop, boxBottom{
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  box-sizing: border-box;
}
.photo{
  width: 30px;
  height: 30px;
  margin-right: 8px;
  border-radius: 50%;
  object-fit: cover;
}
.boxTop{
  justify-content: space-between;
  font-size: 15px;
  font-family: PingFang SC;
  font-weight: 500;
}
.boxTop_left{
  /*width: 80%;*/
  height: 100%;
  display: flex;
  align-items: center;
}
.boxTop_left span{
  display: flex;
}
.boxTop_right{
  font-size: 15px;
}
.boxContent{
  min-height: 50px;
  /*background: rgba(250, 249, 254, 1);*/
  box-sizing: border-box;
  overflow: hidden;
  border-top: 1px solid #e5e5e5;
  padding: 10px;
  box-sizing: border-box;
}
.boxContent_text{
  width: 100%;
  /*height: 100%;*/
  font-size: 15px;
  display: flex;
  text-align: justify;
  word-break: break-all;
  font-family: "PingFang SC";
}
.boxContent_text p{
  width: 100%;
  line-height: 1.8;
  /*// 单行*/
  overflow: hidden;
  text-overflow:ellipsis;
  white-space: nowrap;
  margin-bottom:8px;
}
.price{
  min-height: 40px;
  font-size: 15px;
  font-family: PingFang SC;
  font-weight: 500;
  color: #333333;
  padding: 0 10px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  /*justify-content: flex-end;*/
  /*border-top: 1px solid #E5E5E5;*/
  border-bottom: 1px solid #E5E5E5;
}
.price span:nth-child(2){
  font-weight: bold;
}
.boxContent_bottom{
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  padding: 5px 10px 5px 10px;
  box-sizing: border-box;
}
.boxContent_bottom p {
  line-height: 1.7;
  /*margin-bottom: 3px;*/
}
.boxBottom{
  height: 35px;
  display: flex;
  font-size: 14px;
  justify-content: space-between;
  /*flex-direction: row-reverse;*/
  padding: 0 10px;
  box-sizing: border-box;
}
.boxBottom .qianDao{
  height: 100%;
  display: flex;
  align-items: center;
  /*position: fixed;*/
  /*left: 30px;*/
}
.qianDao img{
  margin-right: 8px;
}
.box_button{
  /*width: 75px;*/
  min-width: 75px;
  height: 29px;
  border-radius: 5px;
  background: white;
  margin-top: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  font-family: "PingFang SC";
  margin-left: 10px;
  padding: 0 5px;
  box-sizing: border-box;
}
.colorGary{
  color: #999999;
}
.btnGary{
  border: 1px solid #E5E5E5;
  color: #999;
}
.btnRed{
  color: #E3170D;
  border: 1px solid #E3170D;
}
.btnBlack{
  color: #333;
  border: 1px solid #999;
}
.red{
  color: rgba(227, 23, 13, 1);
}
.blue{
  color: #1DA4F2;
}
.btnBule{
  color: #1da4f2;
  border: 1px solid #1DA4F2;
}
.wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 90%;
}
/deep/ .van-overlay{
  z-index: 999;
}
.block {
  width: 90%;
  height: 70%;
  background-color: #fff;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}
.xuzhiTop{
  width: 100%;
  height: 44px;
  font-size: 17px;
  font-family: PingFang SC;
  font-weight: bold;
  color: #333333;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #E5E5E5;
}
.xuzhiContent{
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  height: 70%;
  overflow: auto;
}
.xuzhiContent ul li{
  margin-bottom: 10px;
  font-size: 15px;
  color: #333333;
}
/*.select{*/
/*  width: 100%;*/
/*  font-size: 15px;*/
/*  color: #1DA4F2;*/
/*  display: flex;*/
/*  min-height: 44px;*/
/*  background: #FFFFFF;*/
/*  display: flex;*/
/*  !*align-items: center;*!*/
/*}*/
/*.select img{*/
/*  width: 16px;*/
/*  height: 16px;*/
/*  margin-left: 10px;*/
/*  margin-right: 5px;*/
/*  margin-top: 1.5px;*/
/*}*/
.next{
  width: 100%;
  height: 44px;
  color: #1DA4F2;
  font-size: 17px;
  font-family: PingFang SC;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid #E5E5E5;
}
.bottom{
  background: #fff;
  width: 100%;
  position: absolute;
  bottom: 0;
}
.blue{
  color: #1DA4F2;
}
.green{
  color: rgba(46, 196, 155, 1);
}
/deep/ .van-tab{
  font-size: 15px;
}
/*.price{*/
/*  font-size: 11px !important;*/
/*  font-family: PingFang SC;*/
/*  font-weight: 500;*/
/*  color: #1DA4F2;*/
/*  margin-right: 10px;*/
/*}*/
/deep/ .van-tab__text&#45;&#45;ellipsis,
/deep/ .van-tab{
  font-size: 15px;
}
/*.blue{*/
/*  color: #1da5f2!important;*/
/*}*/
.tagTuandui{
  font-size: 11px;
  min-height: 18px;
  padding: 0 5px;
  box-sizing: border-box;
  background: linear-gradient(90deg, #F9BD77, #FFED91);
  border-radius: 19px;
  border: none;
  color: #A8610B;
  margin-left: 10px;
}
</style>
-->
